$(function () {
    var iSBLId = xhTool.getQuery('iSBLId');

    $(function () { //加载时间轴
        $.ajax({
            url : baseUrl+'school_book/getLog/'+iSBLId,
            dataType:'JSON',
            type:'Post',
            success:function (data) {
                timeLine.loadTimeLine($('#timeWraper'),data['data'],'推进进度',data['showDelete'],data['showEdit']);
            },
            error:function (result) {
                console.log(result);
            }
        });
    });



   $('#new').click(function () {

       window.top.xhTop.showModal({
           title:'新增日志',
           content: '<iframe src="'+baseUrl+'school_book/logForm/'+iSBLId+'"  style="width: 100%;;border-style: none;padding: 0px;height: 320px"  scrolling="yes"   ></iframe>',
           button:'提交',
           backClose: false,
           width:720
       })
   });


    //编辑加载数据
    $('#timeWraper').on('click','[id^=edit_]',function () {
        var iSBEId=$(this).attr("id").split("edit_")[1];
        window.top.xhTop.showModal({
            title:'编辑日志',
            content:'<iframe src="'+baseUrl+'school_book/logForm/'+iSBLId+'/'+iSBEId+'"  style="width: 100%;;border-style: none;padding: 0px;height:330px"  scrolling="yes"   ></iframe>',
            button:'提交',
            backClose:false,
            width:720
        });
    });

    //删除加载数据
    $('#timeWraper').on('click','[id^=delete_]',function () {
        var iSBEId = $(this).attr("id").split("delete_")[1];
        xhExtra.askChangeStatus('school_book/delLog',{iSBEId:iSBEId},null,null,function (res) {
            window.top.xhTop.showSuccess(res.msg);
        })

    });
});